package com.srq.controller;

import com.srq.pojo.User;
import com.srq.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping("/user")
public class UserController {
    private UserService userService;
    @RequestMapping("/list")
    public ModelAndView findAllUser(){
        List<User> userList=userService.findAllUser();
        ModelAndView modelAndView=new ModelAndView();
        modelAndView.addObject("userList",userList);
        modelAndView.setViewName("user-list");
        return modelAndView;

    }
}
